import Vue from 'vue';
import VueRouter from 'vue-router';


//let Layout = Vue.component('justLayout',{template:'<router-view></router-view>'});
import Wrapper from '../page/common/wrapper';
import Couter from '../page/counter/Counter';
import ContactList from '../page/contact/Contactlist';
import ContactDetail from '../page/contact/ContactDetail';
import ContactAdd from '../page/contact/ContactAdd';
import ContactEdit from '../page/contact/ContactEdit';
Vue.use(VueRouter); //挂载使用路由



//纯路由配置
const routes = [
  { path: '/',name:'home',redirect:'/counter'},
  { path: '/counter',name:'counter',component:Couter},
  { path: '/contact',name:'contact',component:Wrapper,children:[
    {path:'',redirect:'/contact/list'},
    {path:'list',name:'contactlist',component:ContactList},
    {path:'detail/:contactId',name:'contactdetail',component:ContactDetail},
    {path:'add',name:'contactadd',component:ContactAdd},
    {path:'edit/:contactId',name:'contactedit',component:ContactEdit},
  ]}
]
//生成一个路由实例
const router = new VueRouter({
  mode: 'history', //默认是hash路由
  routes
});
export default router;
